/*
 * Copyright (C) 2017 Pingan, Inc. All Rights Reserved.
 */

package com.pingan.haofang.searchcloud.api.facade;

import com.pingan.haofang.searchcloud.api.CollectionSummaryDto;
import com.pingan.haofang.searchcloud.api.DiskConditonDTO;
import com.pingan.haofang.searchcloud.api.StorageCluster;
import com.pingan.haofang.searchcloud.api.matedata.CollectionMetaData;

import java.util.List;
import java.util.Map;

/**
 * 搜索存储collection管理
 *
 * @author zhangbi617
 * @date 2017-07-14
 */
public interface CollectionManageFacade {
    /**
     * 创建一个CollectionMetaData元数据
     *
     * @param storageCluster
     * @param collectionMetaData
     * @return
     * @throws Exception
     */
    boolean create(StorageCluster storageCluster, CollectionMetaData collectionMetaData) throws Exception;

    /**
     * 根据collectionName删除
     *
     * @param storageCluster
     * @param collectionName
     * @return
     * @throws Exception
     */
    boolean delete(StorageCluster storageCluster, String collectionName) throws Exception;

    /**
     * 获取到所有的collectionNames
     *
     * @param storageCluster
     * @return
     * @throws Exception
     */
    List<String> listAllCollectionNames(StorageCluster storageCluster) throws Exception;

    /**
     * 获取服务器所有collection的概况
     *
     * @param storageCluster
     * @return
     * @throws Exception
     */
    Map<String, CollectionSummaryDto> listAllCollectionSummary(StorageCluster storageCluster, List<CollectionMetaData> currentCollectionList) throws Exception;

    /**
     * 获取集群中的存活的节点
     *
     * @param storageCluster 集群host
     * @return
     */
    List<String> getLiveHostUrl(StorageCluster storageCluster);

    /**
     * 获取集群中节点的统计信息
     *
     * @param storageCluster 集群host
     * @return
     */
    Map<String, DiskConditonDTO> getNodesSummary(StorageCluster storageCluster) throws Exception;
}
